﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Plazos
{
    public partial class FormModificarSemestre : Form
    {
        public FormModificarSemestre()
        {
            InitializeComponent();
        }

        private void buttonBuscarModSemestre_Click(object sender, EventArgs e)
        {
            Semestre sem = new Semestre();
            String s;
            if (checkedListModSemestre.CheckedItems.Count==1)
            {
                for (int x = 0; x <= checkedListModSemestre.CheckedItems.Count - 1; x++)
                {
                    s = checkedListModSemestre.CheckedItems[x].ToString();
                    FormModificarConvenio frm = new FormModificarConvenio(s);
                    frm.Show();
                    
                }
            }
            if (checkedListModSemestre.CheckedItems.Count == 0) {
                MessageBox.Show("Debe ingresar un semestre");
            }
            if (checkedListModSemestre.CheckedItems.Count >1)
            {
                MessageBox.Show("Debe ingresar un solo semestre");
            }
            
            
        }

        private void FormModificarSemestre_Load(object sender, EventArgs e)
        {
             Semestre sem = new Semestre();
            List<Semestre> semestres = sem.getSemestres();
            foreach (Semestre s in semestres)
            {
                Console.WriteLine("idSem: " + s.IdSem + ">");
                checkedListModSemestre.Items.Add(s.NombreSem);
            }
        }
    }
}
